/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Utilities.generateVector;

import aliasMatching.controller.TestFile;
import aliasMatching.controller.TimeEquality;
import aliasMatching.model.Alias;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author ITE
 */
public class returnTimeVector {

    List users;
    static List<List> timeVector = new ArrayList();

    public static void main(String args[]) throws SQLException, IOException {
        Alias tf = new Alias();
        TimeEquality te = new TimeEquality();
        List users = tf.getAllUsers();

        for (int i = 0; i < users.size(); i++) {
            String tempUser = users.get(i).toString();
            int UserID = Integer.parseInt(tempUser);
            double[] tempTimeVector = te.getTimeVector(UserID);
            String timeString = null;
            for (int j = 0; j < tempTimeVector.length; j++) {
                double tempTime = tempTimeVector[j];
                timeString = Double.toString(tempTime);
            }
            List timeVectorList = new ArrayList();
            timeVectorList.add(timeString);
            //List tempList = Arrays.asList(tempTimeVector);
            timeVector.add(timeVectorList);
        }
        saveToFile(timeVector);
    }

    public static void saveToFile(List timeVectorList) throws IOException {
        // String testfile = "This is to write";
        File file = new File("C:\\Users\\ITE\\Documents\\NetBeansProjects\\BoardAliasMatching\\src\\Utilities\\generateVector\\result.txt");
        FileWriter fw = new FileWriter(file.getAbsoluteFile());
        BufferedWriter bw = new BufferedWriter(fw);

        List element = new ArrayList();
        Iterator<List> totalTimeVector = timeVectorList.iterator();

        while (totalTimeVector.hasNext()) {
            element = totalTimeVector.next();
            

        }
        bw.close();
    }
}
